package com.qijia.common.domain;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;

/**
 * AbstractCommonResource entity provides the base persistence definition of the
 * CommonResource entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractCommonResource extends BaseData implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -6402244479134029419L;
	private Integer CResourceId;
	private String CResourceName;
	private String CResourceTitle;
	private String CResourceCode;
	private String CResourceUrl;
	private Integer CResourceType;
	private Set<RoleResource> commonRoleResources = new HashSet<RoleResource>(0);

	// Constructors

	/** default constructor */
	public AbstractCommonResource() {
	}

	/** minimal constructor */
	public AbstractCommonResource(String CResourceName, Integer CResourceType) {
		this.CResourceName = CResourceName;
		this.CResourceType = CResourceType;
	}

	/** full constructor */
	public AbstractCommonResource(String CResourceName, String CResourceTitle,
			String CResourceCode, String CResourceUrl, Integer CResourceType,
			Set<RoleResource> commonRoleResources) {
		this.CResourceName = CResourceName;
		this.CResourceTitle = CResourceTitle;
		this.CResourceCode = CResourceCode;
		this.CResourceUrl = CResourceUrl;
		this.CResourceType = CResourceType;
		this.commonRoleResources = commonRoleResources;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "c_resource_id", unique = true, nullable = false)
	public Integer getCResourceId() {
		return this.CResourceId;
	}

	public void setCResourceId(Integer CResourceId) {
		this.CResourceId = CResourceId;
	}

	@Column(name = "c_resource_name", nullable = false, length = 64)
	public String getCResourceName() {
		return this.CResourceName;
	}

	public void setCResourceName(String CResourceName) {
		this.CResourceName = CResourceName;
	}

	@Column(name = "c_resource_title", length = 64)
	public String getCResourceTitle() {
		return this.CResourceTitle;
	}

	public void setCResourceTitle(String CResourceTitle) {
		this.CResourceTitle = CResourceTitle;
	}

	@Column(name = "c_resource_code", length = 64)
	public String getCResourceCode() {
		return this.CResourceCode;
	}

	public void setCResourceCode(String CResourceCode) {
		this.CResourceCode = CResourceCode;
	}

	@Column(name = "c_resource_url", length = 128)
	public String getCResourceUrl() {
		return this.CResourceUrl;
	}

	public void setCResourceUrl(String CResourceUrl) {
		this.CResourceUrl = CResourceUrl;
	}

	@Column(name = "c_resource_type", nullable = false)
	public Integer getCResourceType() {
		return this.CResourceType;
	}

	public void setCResourceType(Integer CResourceType) {
		this.CResourceType = CResourceType;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "resource")
	public Set<RoleResource> getCommonRoleResources() {
		return this.commonRoleResources;
	}

	public void setCommonRoleResources(
			Set<RoleResource> commonRoleResources) {
		this.commonRoleResources = commonRoleResources;
	}

}